package Tagger;

import java.util.HashMap;

import DataObjects.Article;
import DataObjects.Topic;

public class DemoTagger implements Tagger {

	private Topic topic;
	private HashMap<Integer, Topic> allTopics;

	public void addArticleTopics(Article article, String fileName) {
		int x=((int)(Math.random()*3));
		int y=((int)(Math.random()*3));
		if (x==y)
			article.addTopic(allTopics.get((x)));
		else
		{
			article.addTopic(allTopics.get((x)));
			article.addTopic(allTopics.get((y)));
		}
	}

	public HashMap<Integer, Topic> tagCorpus(String corpusPath) {
		HashMap<Integer, Topic> ans=new HashMap<Integer, Topic>();
		for(int i=0;i<3;i++){
			topic=new Topic(i);
			topic.addWord("word "+(i*3+1));
			topic.addWord("word "+(i*3+2));
			topic.addWord("word "+(i*3+3));
			ans.put(i, topic);
		}
		allTopics=ans;
		return ans;
	}

	public HashMap<Integer, Topic> getAllTopics(){
		if (allTopics==null){
			HashMap<Integer, Topic> ans=new HashMap<Integer, Topic>();
			for(int i=0;i<3;i++){
				topic=new Topic(i);
				topic.addWord("word "+(i*3+1));
				topic.addWord("word "+(i*3+2));
				topic.addWord("word "+(i*3+3));
				ans.put(i, topic);
			}
			allTopics=ans;
		}
		return allTopics;
	}
}
